package cn.ymkj.service.impl;

import cn.ymkj.pojo.User;
import cn.ymkj.service.UserService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public User checkLogin(String username,String password) {
        User user = null;
        if("admin".equals(username)&&"1234".equals(password)){
            user = new User(1001,"admin",null,"天外流星",18,1,"https://5997ck.oss-cn-beijing.aliyuncs.com/images/1.jpg");
        }
        return user;
    }

    @Override
    public List<User> findAll() {
        List<User> users = new ArrayList<>();
        users.add(new User(1001,"admin",null,"天外流星",18,1,"https://5997ck.oss-cn-beijing.aliyuncs.com/images/1.jpg"));
        users.add(new User(1002,"xiaocang",null,"亚麻跌",19,0,"https://5997ck.oss-cn-beijing.aliyuncs.com/images/1.jpg"));
        users.add(new User(1003,"xiaoze",null,"思密达",20,0,"https://5997ck.oss-cn-beijing.aliyuncs.com/images/1.jpg"));
        return users;
    }

    @Override
    public int deleteById(Integer userId) {
        System.out.println("userId="+userId);
        return 1;
    }
}
